package com.qianfeng.smartdevice.controller;

import com.qianfeng.smartdevice.dto.R;
import com.qianfeng.smartdevice.pojo.SysScene;
import com.qianfeng.smartdevice.service.SysSceneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by wenka on 2022/3/27 15:21
 *
 * @author Jackiechan
 * @version 1.0
 * @since 1.0
 */
@RestController
@RequestMapping("/scenes")
public class SysSceneController {
    private SysSceneService sysSceneService;

    @Autowired
    public void setSysSceneService(SysSceneService sysSceneService) {
        this.sysSceneService = sysSceneService;
    }
    @PostMapping("/scene")
    public R addScene(@RequestBody SysScene sysScene){
        sysSceneService.addSysScene(sysScene);
        return R.steOK();
    }
    @GetMapping("/scene/{id}")
    public R findById(@PathVariable Long id){
        SysScene sysSceneServiceById = sysSceneService.findById(id);
        return R.setOK(sysSceneServiceById);
    }
}
